//新增前端赋值
$(function () {

    $.ajax({
        type: "get",
        url: "/getBaseWorldData",
        success: function(data)
        {
            var i=0
            console.log(data)
           $('#confirmAdd').text(toThousands(data.confirmAdd))
           $('#deadCompare').text(toThousands(data.deadCompare))
           $('#nowConfirm').text(toThousands(data.nowConfirm))

           $('#confirm').text(toThousands(data.confirm))
           $('#dead').text(toThousands(data.dead))
           $('#heal').text(toThousands(data.heal))

           $('#deadRate').text((data.dead*100/data.confirm).toFixed(1)+'%')
           $('#healRate').text((data.heal*100/data.confirm).toFixed(1)+'%')
        }
    })
})


function toThousands(num) {
    var result = [ ], counter = 0;
    num = (num || 0).toString().split('');
    for (var i = num.length - 1; i >= 0; i--) {
        counter++;
        result.unshift(num[i]);
        if (!(counter % 3) && i != 0) { result.unshift(','); }
    }
    return result.join('');
}